export {}

// 字面量注解
// 普通number类型 可以赋任何值
let count: number;
count = 100
count = 200
console.log(count)

// 字面量类型100 只能赋值为100
let count1: 100
count1  = 100
// count1 = 200 // 报错
console.log(count1)

// 应用场景：性别的选择
type Gender = '男'|'女'

let gender:Gender = '男'
console.log(gender)

// 练习
type Res = {
    code: 1001|1002|1103,
    msg: string
}

let res: Res = {
    code: 1001,
    msg: 'ok'
}
console.log(res)